package com.woniu.controller;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.woniu.entity.Result;
import com.woniu.service.IImgsService;
import com.woniu.vo.ImgVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author tanMax
 * @since 2022-10-19
 */
@RestController
@RequestMapping("/imgs")
@Api(tags = "图片库")
public class ImgsController extends BaseController{
    @Autowired
    private IImgsService imgsService;

    @PostMapping
    @ApiOperation("添加商品图片")
    public Result add(@RequestBody ImgVo imgVo){
        Integer row = imgsService.addImgs(imgVo);
        return toResult(row);
    }
    @PutMapping
    @ApiOperation("修改商品图片")
    public Result edit(@RequestBody ImgVo imgVo){
        Integer row = imgsService.editImgs(imgVo);
        return toResult(row);
    }
}
